<?php

namespace IDock\Insurance\LIHI\Request;

use IDock\Insurance\LIHI\Response\EPolicyDownloadResponse;
use IDock\Visitor\EPolicyDownloadVisitor;

class EPolicyDownloadRequest extends AllLIHIRequest
{
    public $route = 'cp/getDZBDFiled';

    protected $response = EPolicyDownloadResponse::class;

    protected $urlTip = '下载电子保单';

    /**
     * @var  EPolicyDownloadVisitor $visitor
     */
    protected $visitor;

    public function generate(): array
    {
        $this->flowId = $this->visitor->argc['flowId'] ?? '';

        $this->agreementCode = $this->visitor->argc['agreementNo'] ?? '';
        $this->recordCode = $this->visitor->argc['recordCode'] ?? '';

        $arr = [
            'businessNo' => $this->visitor->policyNo,
            'appInsured' => '',
        ];
        if (isset($this->visitor->argc['printType'])) {
            $arr['printType'] = $this->visitor->argc['printType'];
        }
        return $arr;
    }
}
